def eight2ten(num):
  print(str(num))
  arr=list(str(num))[::-1]
  sum = 0
  for i in range(len(arr)):
    sum += int(arr[i])*(8**i)
  return sum
print(eight2ten(123))

# 人工智能方法
def eight2tenAI(num):
    return sum(int(digit) * (8 ** idx) for idx, digit in enumerate(reversed(str(num))))
print(eight2tenAI(123))  # 输出: 83